package com.hunray.rent.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
@Entity
@Table(name="t_user_role")
public class UserRole implements Serializable {

	private static final long serialVersionUID = 1L;

	private Integer id;
	
	private User user;
	
	private Role role;
	@Id
	@GeneratedValue(strategy=GenerationType.TABLE,generator="tg_user_role")
	@TableGenerator(name="tg_user_role",table="t_id",pkColumnName="f_table",pkColumnValue="t_user_role",valueColumnName="f_id",initialValue=1,allocationSize=1)
	@Column(name="f_id")
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="f_user",nullable=false)
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="f_role",nullable=false)
	public Role getRole() {
		return role;
	}

	public void setRole(Role role) {
		this.role = role;
	}
	
	
}
